package cn.hanyx.coder.core.concurrent.thread.demo02;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * ThreadTest02
 *
 * @author hanyx
 * @date 2020/09/04
 */
public class ThreadTest02 {
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        Runnable task = () -> {
            System.out.println("Hello World!");
        };
        Thread myThread = new Thread(task);
        myThread.start();
        myThread.join();

        Future future = (Future) Executors.newFixedThreadPool(1).submit(task).get();
    }
}